public class CountMatchingCharacters {
    public static int countMatchingCharacters(String str1, String str2) {
        int count = 0;
        for (int i = 0; i < str1.length(); i++) {
            if (str2.contains(String.valueOf(str1.charAt(i)))) {
                count++;
            }
        }
        return count;
    }
}
